<title><#if pager??>编辑<#else>新增</#if>互动</title>
<link type="text/css" href="${ctx}/resources/css/demo.css"  rel="stylesheet" />
<link type="text/css" href="${ctx}/resources/css/easyui.css"  rel="stylesheet" />
<script type="text/javascript" src="${ctx}/resources/js/jquery.easyui.min.js"></script>
<script>

</script>
<div class="page-header">
	<h1>
		<#if pager??>编辑<#else>新增</#if>互动
		<small>
			<i class="icon-double-angle-right"></i>
		</small>
	</h1>
</div>
<form class="form-horizontal" role="form" id="validation-form" method="POST" action="${ctx}/admin/interact/dosave${suffix}" enctype="multipart/form-data">
<#if pager??>
	<input type="hidden" name="id" value="${pager.id}"/>
</#if>
<div class="form-group">
	<label class="control-label col-xs-12 col-sm-3 no-padding-right" for="name">标题:</label>
	<div class="col-xs-12 col-sm-9">
		<div class="clearfix">
			<span class="block input-icon width-40">
			
				<#if pager??>
					<input type="text" name="title" value="${pager.title!}" class="form-control" placeholder=""/>
				<#else>
					<input type="text" name="title" value="" class="form-control" placeholder=""/>
				</#if>
			</span>
		</div>
	</div>
</div>
<div class="form-group">
	<label class="control-label col-xs-12 col-sm-3 no-padding-right" for="coverPath">图片:</label>
	<div class="col-xs-12 col-sm-9">
		<div class="clearfix">
			<div class="ace-file-input width-40">
			<#if pager??>
				<input type="file" name="coverPath" id="id-input-file-1" value="${pager.image!}">
			<#else>
				<input type="file" name="coverPath" id="id-input-file-1" value="">
			</#if>
			</div>
		</div>
	</div>
</div>
<div class="form-group">
	<label class="control-label col-xs-12 col-sm-3 no-padding-right">分类:</label>
	<div class="col-xs-12 col-sm-9">
		<div class="clearfix">
		<#assign goodsTypes=dicSetting.getParameterMap("interact.type") />
		<@ace.formSingleSelect options=goodsTypes checkValue=(pager.type)!-1 name="type" listKey="key" listValue="value"/>
		</div>
	</div>
</div>
<div class="form-group">
	<label class="control-label col-xs-12 col-sm-3 no-padding-right" >内容:</label>
	<div class="col-xs-12 col-sm-9">
	<input id="production" type="hidden" value=""/>
		<#include "../ueditor.ftl">
	</div>
</div>
<#if pager??>
	<div class="p1">${pager.content!}</div>
</#if>

<div class="form-group">
	<div class="col-md-offset-3 col-md-9">
		<button class="btn btn-info" type="submit"><i class="icon-ok bigger-110"></i>提  交</button>
		&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp;
		<button class="btn" type="reset"><i class="icon-undo bigger-110"></i>重  置</button>
	</div>
</div>

</fieldset>
</form>
<#if errorMsg??>
	<div class="hr hr-18 hr-double dotted"></div>
	<h4 class="lighter">
		<i class="icon-hand-right icon-animated-hand-pointer red"></i>
		<span class="pink">${errorMsg}
		</span>
	</h4>
</#if>
<#assign fieldName="urlList" />
<#assign rootPath="device/goods/urlList/" /><#-- 图片要上传至哪个文件夹 -->
<#assign fieldNameValue=(pager.urlList)!"" />
<#assign isSingle=0 />
<#include "/common-admin/upload/upload_field_after.ftl" />
<script>
var country = Object.create(B.Country);
$(document).ready(function(){
	RP.addBreadcrumb([{name:"基础"}, {name:"<#if pager??>编辑<#else>新增</#if>互动",  active: true}]);
	$('#id-input-file-1').ace_file_input({
		no_file:'没文件 ...',
		btn_choose:'请选择文件',
		btn_change:'重新选择文件',
		droppable:false,
		onchange:null,
		thumbnail:false
	});
	country.regist4Select(${(villagePager.cityCode)!-1},"provinceSelect","citySelect");
	$("#countySelect").hide();
	$('#validation-form').validate({
		errorElement: 'div',
		errorClass: 'help-block',
		focusInvalid: true,
		rules: {
			title:{
				required:true,
				maxlength: 20
			},
			citySelect:{
				required:true,
			},
			linkTel:{
				required:true,
				number:true,
				minlength: 11,
				maxlength: 11
			},
			attachPrice:{
				required:true,
				number:true
			},
			attachSet:{
				required:true,
				number:true
			},
			couponSet:{
				required:true,
				number:true
			},
			address:{
				required:true
			}
		},
	
		messages: {

		},
	
		invalidHandler: function (event, validator) { //display error alert on form submit   
			RP.Form.invalidHandler(event, validator);
		},
	
		highlight: function (e) {
			RP.Form.highlight(e);
		},
		
		errorPlacement: function (error, element) {
			RP.Form.errorPlacement(error, element);	
		},
	
		success: function (e) {
			RP.Form.success(e);	
		},
		
		submitHandler: function(form) {
		 	getC();
		 	$("#cityCode").val($("#citySelect").val());
			RP.Form.submitHandler(form);
		}
	});
});
</script>
<script>
$(function (){
	<#if pager??>
		var o ="${pager.urlList!}";
		var dt = $(".file-name").attr("data-title");
		$(".file-name").attr("data-title",o);
		$(".file-label").attr("data-title","重新选择文件");
	<#else>
	
	</#if>

})
$(function (){
	var ue = UE.getEditor('container');
	<#if pager??>
		$(".p1").css("display","none");
		UE.getEditor('container').ready(function(){
	 		UE.getEditor('container').setContent($(".p1").html());
    	})
	</#if>
})

function getContent(){
	var result;
	UE.getEditor('container').ready(function(){
	 	result = UE.getEditor('container').getContent();
    })
    return result;
}

function getC(){
	$("#production").val(getContent());
}
</script>